<!DOCTYPE html>
<html lang="zh">

	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
		<meta http-equiv="X-UA-Compatible" content="ie=edge" />
		<title>最美教师节，只因遇见你</title>
		<link rel="stylesheet" href="css/public.css" />
	</head>

	<body>
		<div class="container">
			<img src="img/homePageBg.png" />
			<div class="homepage_btn next_btn">
				<img src="img/camera.png" />
				<div class="complete_btnText">上传照片</div>
				<div class="selectPicture" style="height: 100%;">
					<input accept="image/*" type="file" class="selectPictureAddress" />
				</div>
			</div>
		</div>
		<script src="js/rem.js"></script>
		<script src="js/jquery-3.1.1.min.js"></script>
		<script src="js/jweixin-1.0.0.js"></script>
		<script>
			var imgUrl = "https://www.huceo.com/logo.jpg"; //注意必须是绝对路径
			var lineLink = "https://www.huceo.com/wdt.html"; //同样，必须是绝对路径
			var descContent = '最轻便的微电台精选，天天更新，你听或是不听，我都这里等着你。'; //分享给朋友或朋友圈时的文字简介
			var shareTitle = '微信电台精选'; //分享title
			var appid = ''; //apiID，可留空
			
			function shareFriend() {
				WeixinJSBridge.invoke('sendAppMessage', {
					"appid": appid,
					"img_url": imgUrl,
					"img_width": "200",
					"img_height": "200",
					"link": lineLink,
					"desc": descContent,
					"title": shareTitle
						}, function(res) {
							//_report('send_msg', res.err_msg);
						})
					}
					
					function shareTimeline() {
						WeixinJSBridge.invoke('shareTimeline', {
							"img_url": imgUrl,
							"img_width": "200",
							"img_height": "200",
							"link": lineLink,
							"desc": descContent,
							"title": shareTitle
						}, function(res) {
							//_report('timeline', res.err_msg);
						});
					}
					
					function shareWeibo() {
						WeixinJSBridge.invoke('shareWeibo', {
							"content": descContent,
							"url": lineLink,
						}, function(res) {
							//_report('weibo', res.err_msg);
						});
					}
					// 当微信内置浏览器完成内部初始化后会触发WeixinJSBridgeReady事件。
					document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {
						// 发送给好友
						WeixinJSBridge.on('menu:share:appmessage', function(argv) {
							shareFriend();
						});
						// 分享到朋友圈
						WeixinJSBridge.on('menu:share:timeline', function(argv) {
							shareTimeline();
						});
						// 分享到微博
						WeixinJSBridge.on('menu:share:weibo', function(argv) {
							shareWeibo();
						});
					}, false);
			</script>
		<script>
			$(".homepage_btn").click(function() {
				var selectImg = 1;
				sessionStorage.setItem("selectImg", selectImg);

				function readURL(input) {
					if(input.files && input.files[0]) {
						var reader = new FileReader();
						reader.onload = function(e) {
							$('.selectPictureAddress').attr('src', e.target.result);
							var pic = e.target.result;
							var pic2 = input.files[0].name;

							sessionStorage.setItem("pic", pic);
							sessionStorage.setItem("pic2", pic2);
							window.location.href = "choiceTemplate.html"
						}
						reader.readAsDataURL(input.files[0]);
					}
				}
				$(".selectPictureAddress").change(function() {
					readURL(this);
				});

			})
		</script>
	</body>

</html>